import request from '@/utils/request'

// 查询CRM客户列表
export function listCustomer(query) {
  return request({
    url: '/crm/customer/list',
    method: 'get',
    params: query
  })
}

// 查询CRM客户详细
export function getCustomer(id) {
  return request({
    url: '/crm/customer/' + id,
    method: 'get'
  })
}

export function getCustomerBaseInfo(id) {
  console.info(4);
  return request({
    url: '/crm/customer/' + id,
    method: 'get'
  })
}

export function getCustomerByNameAndPhone(name, phone) {
  return request({
    url: '/crm/customer/' + name + "/" + phone,
    method: 'get'
  })
}

export function getListElectricAalesFlowList(query) {
  console.info(1);
  return request({
    url: '/crm/customerFollrecords/list',
    method: 'get',
    params: query
  })
}

export function getListByContract(query) {
  console.info(2);
  return request({
    url: '/crm/company/list',
    method: 'get',
    params: query
  })
}

export function getListOperateLogList(query) {
  console.info(3);
  return request({
    url: '/crm/customerFollrecords/list',
    method: 'get',
    params: query
  })
}

export function getManage(esId) {
  console.info(esId);
  return request({
    url: '/crm/company/getInfos/' + esId,
    method: 'get'
  })
}

// 填写跟进记录
export function followRecords(data) {
  console.info(data);
  return request({
    url: '/crm/customerFollrecords/addRecord',
    method: 'post',
    data: data
  })
}

// 新增CRM客户
export function addCustomer(data) {
  return request({
    url: '/crm/customer',
    method: 'post',
    data: data
  })
}

// 新增CRM客户
export function clueTransferCustomer(data) {
  return request({
    url: '/crm/clue/transferClueToCustomer',
    method: 'post',
    data: data
  })
}

// 修改CRM客户
export function updateCustomer(data) {
  return request({
    url: '/crm/customer',
    method: 'put',
    data: data
  })
}

// 删除CRM客户
export function delCustomer(id) {
  return request({
    url: '/crm/customer/' + id,
    method: 'delete'
  })
}
